const setRem = () => {
  // 获取屏幕宽度
  const screenWidth = document.documentElement.getBoundingClientRect().width;
  // 设置html字体大小
  document.documentElement.style.fontSize = screenWidth/10+"px";
}

setRem();
window.addEventListener('orientationchange', setRem); // 手机横屏视频
window.addEventListener('resize', setRem);